{layout name="public/layout" /}
{include file='yxnavbar'}
<div>
    <form class="form-horizontal form"
        action="{php echo createWebUrl('clive',array('op' => 'update','themeid'=>$themeid));}"
        id="form1" method="post" enctype="multipart/form-data">
        <div class="main">
            <div class="tab-content">
                <div class="tab-pane active" id="basic">
                    <div class="panel panel-default" role="tabpanel">
                        <div class="panel-heading">直播信息</div>
                        <div class="panel-body">
                            <div class="form-group">
                                <label class="col-sm-2 col-xs-12 control-label">直播标题</label>
                                <div class="col-sm-8 col-xs-12">
                                    <input type="text" class="form-control" placeholder="" name="lname"
                                        value="{$r['lname']}">
                                    <span class="help-block"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-xs-12 control-label">直播间ID</label>
                                <div class="col-sm-8 col-xs-12">
                                    <input type="number" class="form-control" placeholder="" name="lid"
                                        value="{$r['liveid']}">
                                    <span class="help-block">-1关闭直播 开启直播：有房间号填写房间号，没有房间内号填写0</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-xs-12 control-label">直播开始时间</label>
                                <div class="col-sm-8 col-xs-12">
                                    {php echo view_form_field_daterange('stime',array('start'=>$r['livetime'],'end'=>$r['livetime']),true);}
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-xs-12 control-label">开启回放</label>
                                <div class="col-sm-4 col-md-4 col-lg-4 col-xs-12">
                                    <label class="radio-inline">
                                        <input name="relive" value="0" {if $r['relive']==0} checked="checked"{/if} type="radio"> 关闭
                                    </label>
                                    <label class="radio-inline">
                                        <input name="relive" value="1" {if $r['relive']==1} checked="checked"{/if} type="radio"> 开启
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <input name="submit" id="btnConfirm" type="submit" value="提交" class="btn btn-primary col-lg-2"
                    style="float: right;">
                <input type="hidden" name="__token__" value="{$Request.token}" />
            </div>
        </div>
    </form>
</div>
{if $r['liveid'] > -1}
<div>
    <script>
        function sendNotify(){
            $.ajax({
            url:"{php echo createWebUrl('clive');}",
            data:{
                op:"notify",
                themeid:{$themeid}
            },
            success:function(e){
                alert("发送完成");
            }
        });
        }
    </script>
        <input type="button" value="发送通知" class="btn btn-primary col-lg-2" onclick="sendNotify()">
</div>
<br/>
<div>
    <div class="main">
        <div class="tab-content">
            <div class="tab-pane active" id="basic">
                <div class="panel panel-default" role="tabpanel">
                    <div class="panel-heading">订阅用户({php echo sizeof($users);}人)</div>
                    <div style="display: flex;flex-wrap: wrap;">
                        {loop $users $u}
                        <div style="display: flex;flex-direction: column;justify-items: center;margin: 10px;text-align: center;align-items: center;width: 70px;">
                            <img src="{$u['avatar']}" style="width:40px;height:40px;border-radius:50%;"/>
                            <div style="text-overflow:ellipsis;overflow: hidden;white-space: nowrap;width: 70px;">{$u['nickname']}</div>
                        </div>
                        {/loop}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/if}
